﻿@model LogisticsLocationModel
@using Nop.Admin.Models.Logistics
@{  
    //page title
    ViewBag.Title = T("Admin.Logistics.Address.EditAddress").Text;
}
@using (Html.BeginForm())
{
    <div class="section-header">
        <div class="title">
            <img src="@Url.Content("~/subsites/Administration/Content/images/ico-delivery.png")" alt="" />
            @T("Admin.Orders.EditOrderDetails") - @Model.Id @Html.ActionLink("(Back to package info)", "PackageEdit", new { id = Model.CustomProperties["packageid"] })
        </div>
        <div class="options">
            <input type="submit" name="save" class="t-button" value="@T("Admin.Common.Save")" />
        </div>
    </div>
    
    @Html.HiddenFor(model => model.Id)
    if ((bool)Model.CustomProperties["editexist"])
    {   
    @Html.Hidden("editExisting", true)
    <div class="adminContent" style="color:red">You are currently editing the existing address.</div>

    }
    else
    {
    @Html.Hidden("editExisting", false)
    <table class="adminContent">
        <tr>
            <td class="adminTitle">Change to an existing address:
            </td>
            <td class="adminData">
                @Html.DropDownListFor(model => model.AddressId, (IList<SelectListItem>)Model.CustomProperties["addresslist"])
            </td>
        </tr>
    </table>

    <br />    
    <table class="adminContent">
        <tr>
            <td>If the existing address is selected, the address changed in the following form will be ignored.
            </td>
        </tr>
    </table>
    }
    @Html.EditorFor(model => model.Address, "Address")
}